package com.jr.mapper;

import com.jr.pojo.LUser;
import com.jr.pojo.PersonResume;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Repository
public interface UserMapper {

    //登录  返回：一条 uid
    ArrayList<LUser> selectLUser(LUser u);
    //注册
    Integer insertLUser(LUser u);

    //修改密码
    @Update("update user set password = #{password} where username=#{username} and email=#{email}")
    Integer updatePsw(LUser u);

    //修改邮箱
    @Update("update user set email=#{email} where username=#{username}")
    int updateEmail(LUser user);



    //查看个人信息
    @Select("select pid,uname,email,phonum,personprofile from resume where username=#{username}")
    PersonResume selectPersonInfo(LUser user);


    //修改个人信息
    int updatePersonInfo(PersonResume pr);

    //注册时，同时添加已经填写的信息填写到个人信息中
    @Insert("insert into resume(pid,username,email) values(null,#{username},#{email})")
    int insertPersonInfo(PersonResume pr);

    //获取用户的会员等级
    @Select("select uvip from user where uid=#{uid}")
    int selectVip(Integer uid);

}
